﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Admin/Views/Shared/Template.Master"
    Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ScriptContent" runat="server">
    <script type="text/javascript" src="/Content/Widget/jquery.fancybox/fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
    <script type="text/javascript" src="/Content/Widget/jquery.fancybox/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
    <link rel="stylesheet" type="text/css" href="/Content/Widget/jquery.fancybox/fancybox/jquery.fancybox-1.3.4.css"
        media="screen" />
    <script type="text/javascript">
        function eidtCandidates(id) {
            window.top.addTab("", "修改应聘信息", '<%=Url.Action("Edit") %>' + '?id=' + id, true);
        }

        function viewCandidates(id) {
            $("#win-view-candidates").window({
                title: '应聘信息',
                width: 600,
                height: 500,
                modal: true,
                shadow: false,
                closed: false,
                cache: false,
                href: '<%=Url.Action("DetailsControl") %>' + '?id=' + id,

                left: 150,
                onClose: function () {
                    $("#win-view-candidates").html("");
                }
            });

        }


        $(function () {
            var lastIndex;
            $('#tt').datagrid({
                width: 'auto',
                height: '400',
                nowrap: false,
                striped: true,
                remoteSort: false,
                collapsible: true,
                fitColumns: true,
                url: '<%=Url.Action("GetCandidatesJson") %>',
                sortName: 'Sort',
                sortOrder: 'asc',
                idField: 'Id',
                pagination: true,
                onLoadSuccess: function () {
                    $("a[name=fancybox-Candidates]").fancybox({
                        'overlayShow': false,
                        'transitionIn': 'elastic',
                        'transitionOut': 'elastic',
                        hideOnOverlayClick: true,
                        hideOnContentClick: true

                    });

                },
                columns: [[
                    { field: 'Id', checkbox: true },
                // { field: 'Code', title: '编号', width: 80 },
                   {field: 'Name', title: '姓名', width: 120 },
                   { field: 'Sex', title: '性别', width: 80 },
                   { field: 'IsRead', title: '已阅', width: 80, formatter: function (value, rec) {
                       return value ? '是' : '否';
                   }
                   },
                       { field: 'PostName', title: '', width: 120 },
                //    { field: 'Sort', title: '排序', width: 80, sortable: true, editor: { type: 'numberbox', options: { precision: 1}} },
                //                    { field: 'Image', title: '图片', width: 40, align: 'center', formatter: function (value, rowData, rec) {
                //                        return '<a name="fancybox-Candidates" style="padding: 0px;margin: 0px;border:0px none;text-align: center;height:16px;width:16px;" href="' + rowData.Image + '"><img style="padding: 0px;margin: 0px;border:0px none;text-align: center;color:#fff;height:16px;width:16px;" alt="' + rowData.Name + '" src="/Content/Admin/image/easyicon_cn_32.png" /></a>'; ;
                //                    }
                //                    },
                //                    {field: 'IsClosed', title: '停用', width: 80, editor: { type: 'checkbox', options: { on: 'true', off: 'false'} }, formatter: function (value, rec) {

                //                        return value ? '是' : '否';
                //                    }
                //                },
                //                    {field: 'OptEdit', title: '修改', width: 80, align: 'center', formatter: function (value, rowData, rec) {
                //                        return '<span style="color:red" class="jqeasyui-datagrid-edit" onclick="eidtCandidates(\'' + rowData.Id + '\')" value=' + rowData.Id + '>修改</span>'; ;
                //                    }
                //                },
                {field: 'OptView', title: '查看', width: 80, align: 'center', formatter: function (value, rowData, rec) {
                    return '<span style="color:red" class="jqeasyui-datagrid-view" onclick="viewCandidates(\'' + rowData.Id + '\')" value=' + rowData.Id + '>查看</span>'; ;
                }
            }

                ]],
            toolbar: [{
                text: '删除',
                iconCls: 'icon-remove',
                handler: function () {
                    var rows = $('#tt').datagrid('getSelections');
                    if (!rows || rows.length == 0) {
                        $.messager.alert('提示', '请选择要删除的数据');
                        return;
                    }
                    var parm;
                    $.each(rows, function (i, n) {
                        if (i == 0) {
                            parm = "id=" + n.Id;
                        }
                        else {
                            parm += "&id=" + n.Id;
                        }
                    });
                    $.messager.confirm('提示', '是否删除这些数据?', function (r) {
                        if (!r) {
                            return;
                        }
                        $.ajax({
                            type: "POST",
                            url: '<%=Url.Action("Delete") %>',
                            data: parm,
                            success: function (msg) {
                                if (msg.state) {
                                    $.messager.alert('提示', '删除成功！', "info", function () {
                                        $('#tt').datagrid("reload");
                                    });
                                }
                            },
                            error: function () {
                                $.messager.alert('错误', '删除失败！', "error");
                            }
                        });
                    });
                }
            }],
            onBeforeLoad: function () {
                $(this).datagrid('rejectChanges');
            },
            onClickRow: function (rowIndex) {

            },
            onSelect: function (rowIndex, rowData) {

            }
        });
    });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div region="center" style="width: auto; height: 100%; padding: 1px; position: relative;
        overflow-y: auto">
        <table id="tt" style="height: 100%" title="应聘信息列表" iconcls="icon-edit">
        </table>
        <div id="win-view-candidates">
        </div>
    </div>
</asp:Content>
